import React from "react";
import ReactDOM from "react-dom/client";

/**
 * 列表渲染
 */
class MyComponent extends React.Component {
  // 定义在 class 组件中自身私有使用数据
  state = {
    hobbies: ["吃饭", "睡觉", "玩游戏（qiaodaima）"],
  };

  render() {
    return (
      <ul>
        {this.state.hobbies.map(function (currentItem, index, array) {
          return <li key={index}>{currentItem}</li>;
        })}
      </ul>
    );
  }
}

const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(<MyComponent title="千锋" />);
